﻿using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Battle.Net.Infrastructure;

namespace Battle.Net.Model
{
    [DataContract]
    public class RealmAuctions
    {
        [DataMember(Name = "realm")]
        public AuctionDetail Realm { get; set; }

        [DataMember(Name = "alliance")]
        public Auctions Alliance { get; set; }

        [DataMember(Name = "horde")]
        public Auctions Horde { get; set; }

        [DataMember(Name = "neutral")]
        public Auctions Neutral { get; set; }

        [DataMember(Name = "files")]
        public List<AuctionFile> Files { get; set; }
    }

    [DataContract]
    public class AuctionDetail
    {
        [DataMember(Name = "name")]
        public string Name { get; set; }
        [DataMember(Name = "slug")]
        public string Slug { get; set; }
    }

    [DataContract]
    public class Auctions
    {
        [DataMember(Name = "auctions")]
        public List<Auction> List { get; set; }
    }

    [DataContract]
    public class Auction
    {
        [DataMember(Name = "auc")]
        public int AuctionId { get; set; }
        [DataMember(Name = "item")]
        public int ItemId { get; set; }
        [DataMember(Name = "owner")]
        public string Owner { get; set; }
        [DataMember(Name = "bid")]
        public Int64 Bid { get; set; }
        [DataMember(Name = "buyout")]
        public Int64 BuyOut { get; set; }
        [DataMember(Name = "quantity")]
        public int Quantity { get; set; }

        [DataMember(Name = "timeLeft")]
        internal string InternalTimeLeft
        {
            get { return TimeLeft.ToString(); }
            set { TimeLeft = value.FromEnumString<TimeLeft>(); }
        }

        public TimeLeft TimeLeft { get; set; }
    }


}
